require 'pipe'
class Main307
  include Filters
  
  attr_reader :history, :filters, :combinations, :all_result
  
  def initialize
    @history = [
    [02, 04, 16, 20, 22, 24, 25],
    [01, 02, 03, 07, 13, 29, 30],
    [02, 04, 10, 14, 18, 20, 28],
    [03, 06, 9, 10, 12, 15, 30],
    [05, 07, 21, 23, 24, 25, 27],
    [06, 07, 8, 12, 18, 22, 28],
    [07, 12, 13, 15, 17, 22, 25],
    [03, 06, 9, 11, 23, 28, 30],
    ]
    
    @filters = [
    not_(all_even()), 
    not_(all_odd()), 
    SumRange.new((68..148)), 
    ContinuousLimit.new(4), 
    RangeLimit.new((1..10), (11..20), (21..30)),
    PreviousLimit.new(self.history, 3),
    LastLimit.new(self.history, 3),
    ]
    
    @combinations = (1..30).to_a.combination(7)
    
    @all_result = Main3.new(*self.filters).process(self.combinations)
    
  end
  
  def run
    10.times { print self.all_result.choice, "\n" }    
  end  
end

Main_307 = Main307.new

require "test/unit"

class PipeTest < Test::Unit::TestCase
  def test_should_call_all_filters
    Main_307.run
  end
  
  def test_enum
    for bingo in Main_307.history
      assert Main_307.all_result.include?(bingo)
    end
  end
end
